package com.ruoyi.api.controller;

import com.ruoyi.api.service.InventoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.product.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * WX识别判断库存
 */

@Controller
@RequestMapping("/wx/business/InventoryCount")
public class  InventoryCountController extends BaseController {

    @Autowired
    private InventoryService inventoryService;

    /**
     * 查询库存列表
     */
    @PostMapping("/InventoryCount")
    @ResponseBody
    public TableDataInfo list(Product product) {
        startPage();
        return inventoryService.selectProductInventoryCount(product);
    }

    protected TableDataInfo getDataTable2(List<?> list) {
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(0);
        rspData.setRows(list);
        rspData.setTotal(list.size());
        return rspData;
    }
}
